<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black" name="apple-mobile-web-app-status-bar-style">
    <meta content="telephone=no" name="format-detection">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="css/style.css?v1" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="../../resources/easyui/plugin/jquery.cookie.js"></script>
    <title>中奖信息</title>
    <script type="text/javascript">
        //格式化日期
        Date.prototype.format = function(format){
            var o = {
                "M+" : this.getMonth()+1, //month
                "d+" : this.getDate(), //day
                "h+" : this.getHours(), //hour
                "m+" : this.getMinutes(), //minute
                "s+" : this.getSeconds(), //second
                "q+" : Math.floor((this.getMonth()+3)/3), //quarter
                "S" : this.getMilliseconds() //millisecond
            };

            if(/(y+)/.test(format)) {
                format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
            }

            for(var k in o) {
                if(new RegExp("("+ k +")").test(format)) {
                    format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
                }
            }
            return format;
        };

        //判断是否带有参数
        var appId = '';
        var openId = '';
        if(document.URL.lastIndexOf("?") > 0) {
            var arr=document.URL.substring(document.URL.lastIndexOf("?")+1, document.URL.length).split("&");
            for(var i=0;i<arr.length; i++)
            {
                if(arr[i].split("=")[0] == 'appId') {
                    appId = arr[i].split("=")[1];
                } else if(arr[i].split("=")[0] == 'openId') {
                    openId = arr[i].split("=")[1];
                }
            }
        }

        $(document).ready(function () {
            if(appId == '' || openId == '') {
                document.body.innerHTML = '请关注内蒙古移动E生活微信公众号，以指定方式参加活动。';
            }

            setMyPrizes();
        });

        function setMyPrizes() {
            var html='';
            var prizeList = $('#gundong1');
            $.ajax({
                type: 'POST',
                url: '/rest/slot/prize',
                data: {"appId": appId, "openId": openId},
                success: function(data){
                    html += "<ul>";
                    for(var o in data) {
                        html += '<li><span><p>';

                        var tel = data[o].tel;
                        tel = tel.substring(0,3)+"****"+tel.substring(7,11);
                        var result = data[o].result;
                        html += tel + "</p><p style='margin-top: -12px;'>" + result + "</p></span>";

                        html += '<span>' + new Date(data[o].finishTime).format('yyyy年MM月dd日') + '</span></li>';
                    }
                    html += "</ul>";
                    prizeList.html(html);
                }
            });
        }
    </script>
</head>
<body>
<form id="form1" runat="server">
    <div class="page">
        <div class="ban1"><img src="images/bg_cj_01.jpg" width="100%"/></div>
        <div class="list1">
            <div class="list2">
                <div class="zjbt"><span>奖品</span><span>时间</span></div>
                <div id="gundong1">
                </div>
            </div>
        </div>
        <img src="images/bg_cj_02.jpg" width="100%"/>
    </div>
</form>
</body>
</html>